package rtp.servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import rtp.model.TarefaManager;

/**
 * Servlet implementation class CriarTarefaServlet
 */
@WebServlet("/CriarTarefaServlet")
public class CriarTarefaServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public CriarTarefaServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    	
    	String titulo = request.getParameter("titulo");
    	String dtPrazo = request.getParameter("dtPrazo");
    	String responsavel = 	request.getParameter("responsavel");
    	/**colocar os demais em casa*/

    	String msg = TarefaManager.criarTarefa(titulo, 	dtPrazo, responsavel);

    	request.setAttribute("msgStatus", msg);

    	RequestDispatcher view = 	request.getRequestDispatcher("tarefaCriada.jsp");
    	view.forward(request, response);
    }

}
